function quit(pathway){
	if(confirm("Exit ?")) {
		document.location.replace(pathway+"/index.php?logout=true");
	}
}

function surdecreernouveauformulaire(pathway){
	if(confirm("Create a new form ?")) {
		document.location.replace(pathway+"/clinique/page_principale.php?form=new");
	}else{
		document.location.replace(pathway+"/start.php");
	}
}

function toggleType(texte){
	if(texte == 'link'){
		elmt1 = document.getElementById('linkage');
		elmt1.style.display = 'block';
		elmt1 = document.getElementById('conclusion_linkage');
		elmt1.style.display = 'block';
		elmt2 = document.getElementById('screening');
		elmt2.style.display = 'none';
		elmt2 = document.getElementById('conclusion_screening');
		elmt2.style.display = 'none';
		elmt3 = document.getElementById('wholegenomeanalysis');
		elmt3.style.display = 'none';
		elmt3 = document.getElementById('conclusion_wholegenomeanalysis');
		elmt3.style.display = 'none';
		elmt4 = document.getElementById('sampledata');
		elmt4.style.display = 'none';
		elmt4 = document.getElementById('conclusion_sampledata');
		elmt4.style.display = 'none';
	}else if(texte == 'crib'){
		elmt1 = document.getElementById('linkage');
		elmt1.style.display = 'none';
		elmt1 = document.getElementById('conclusion_linkage');
		elmt1.style.display = 'none';
		elmt2 = document.getElementById('screening');
		elmt2.style.display = 'block';
		elmt2 = document.getElementById('conclusion_screening');
		elmt2.style.display = 'block';
		elmt3 = document.getElementById('wholegenomeanalysis');
		elmt3.style.display = 'none';
		elmt3 = document.getElementById('conclusion_wholegenomeanalysis');
		elmt3.style.display = 'none';
		elmt4 = document.getElementById('sampledata');
		elmt4.style.display = 'none';
		elmt4 = document.getElementById('conclusion_sampledata');
		elmt4.style.display = 'none';
	}else if(texte == 'wg'){
		elmt1 = document.getElementById('linkage');
		elmt1.style.display = 'none';
		elmt1 = document.getElementById('conclusion_linkage');
		elmt1.style.display = 'none';
		elmt2 = document.getElementById('screening');
		elmt2.style.display = 'none';
		elmt2 = document.getElementById('conclusion_screening');
		elmt2.style.display = 'none';
		elmt3 = document.getElementById('wholegenomeanalysis');
		elmt3.style.display = 'block';
		elmt3 = document.getElementById('conclusion_wholegenomeanalysis');
		elmt3.style.display = 'block';
		elmt4 = document.getElementById('sampledata');
		elmt4.style.display = 'none';
		elmt4 = document.getElementById('conclusion_sampledata');
		elmt4.style.display = 'none';
	}else if(texte == 'samdata'){
		elmt1 = document.getElementById('linkage');
		elmt1.style.display = 'none';
		elmt1 = document.getElementById('conclusion_linkage');
		elmt1.style.display = 'none';
		elmt2 = document.getElementById('screening');
		elmt2.style.display = 'none';
		elmt2 = document.getElementById('conclusion_screening');
		elmt2.style.display = 'none';
		elmt3 = document.getElementById('wholegenomeanalysis');
		elmt3.style.display = 'none';
		elmt3 = document.getElementById('conclusion_wholegenomeanalysis');
		elmt3.style.display = 'none';
		elmt4 = document.getElementById('sampledata');
		elmt4.style.display = 'block';
		elmt4 = document.getElementById('conclusion_sampledata');
		elmt4.style.display = 'block';
	}
}





function toggleHaplotype(texte){
	if(texte == 'recessif'){
		elmt = document.getElementById('hap1');
		elmt.style.display = 'block';
		elmt = document.getElementById('hap2');
		elmt.style.display = 'none';
		elmt = document.getElementById('hap3');
		elmt.style.display = 'none';
	}else if(texte == 'dominant'){
		elmt = document.getElementById('hap1');
		elmt.style.display = 'none';
		elmt = document.getElementById('hap2');
		elmt.style.display = 'block';
		elmt = document.getElementById('hap3');
		elmt.style.display = 'none';
	}else if(texte == 'xlinked'){
		elmt = document.getElementById('hap1');
		elmt.style.display = 'none';
		elmt = document.getElementById('hap2');
		elmt.style.display = 'none';
		elmt = document.getElementById('hap3');
		elmt.style.display = 'block';
	}else if(texte == 'pseudodominant'){
		elmt = document.getElementById('hap1');
		elmt.style.display = 'none';
		elmt = document.getElementById('hap2');
		elmt.style.display = 'none';
		elmt = document.getElementById('hap3');
		elmt.style.display = 'block';
	}else if(texte == 'sporadique'){
		elmt = document.getElementById('hap1');
		elmt.style.display = 'none';
		elmt = document.getElementById('hap2');
		elmt.style.display = 'none';
		elmt = document.getElementById('hap3');
		elmt.style.display = 'none';
	}	
		
}




function toggleDisplayAutrePrelevement(texte){
	if(texte == 'autre ...'){
		elmt1 = document.getElementById('divautreprelevementsample');
		elmt1.style.display = 'block';
	}else{
		elmt1 = document.getElementById('divautreprelevementsample');
		elmt1.style.display = 'none';
	}
}

function toggleDisplayTodoPrelevement(texte){
	if(texte == 'autre ...'){
		elmt1 = document.getElementById('divtodoprelevement');
		elmt1.style.display = 'block';
	}else{
		elmt1 = document.getElementById('divtodoprelevement');
		elmt1.style.display = 'none';
	}
}

function toggleDisplayMutationAllele(texte){
	if(texte == 'recessive'){
		elmt1 = document.getElementById('divmutationallelechamp1');
		elmt1.style.display = 'block';
		elmt2 = document.getElementById('divmutationallelechamp2');
		elmt2.style.display = 'block';
	}else if(texte == 'dominant'){
		elmt1 = document.getElementById('divmutationallelechamp1');
		elmt1.style.display = 'block';
		elmt2 = document.getElementById('divmutationallelechamp2');
		elmt2.style.display = 'none';
	}	
		
}

function toggleDisplayTechnique(texte){
	if(texte == 'sequencing'){
		elmt1 = document.getElementById('divallelenom');
		elmt1.style.display = 'block';
		elmt1 = document.getElementById('divmutationnom');
		elmt1.style.display = 'none';
	}else if(texte == 'high density microarray'){
		elmt1 = document.getElementById('divallelenom');
		elmt1.style.display = 'block';
		elmt1 = document.getElementById('divmutationnom');
		elmt1.style.display = 'none';
	}else if(texte == 'genotyping'){
		elmt1 = document.getElementById('divallelenom');
		elmt1.style.display = 'block';
		elmt1 = document.getElementById('divmutationnom');
		elmt1.style.display = 'none';
	}else{
		elmt1 = document.getElementById('divallelenom');
		elmt1.style.display = 'none';
		elmt1 = document.getElementById('divmutationnom');
		elmt1.style.display = 'block';
	}
}

  //~ $(document).ready(function(elmt){
    //~ var data = 'elmt'.split(' ');
//~ $('#example').autocomplete(data);
  //~ });
//~ 
//~ 
//~ $(document).ready(function() {
	//~ $("input#autocompletelinkage").autocomplete({
		//~ source: [
		//~ $recupfamillelinkage = "SELECT `codefamille`
				//~ $FROM `$db`.`linkage`";
				//~ $$resultatlinkage = mysql_query($recupfamillelinkage) or die("Impossible de trouver liste familles table linkage : " . mysql_error());
				//~ $while($dnn = mysql_fetch_assoc($resultatlinkage)){
				//~ $	echo '"'.$dnn['codefamille'].'",';
				//~ $}
		//~ 
		//~ ]
	//~ });
	//~ 
	//~ $("input#autocompletescreening").autocomplete({
		//~ source: [
				//~ $$recupfamillescreening = "SELECT `codefamille`
				//~ $FROM `$db`.`screening`";
				//~ $$resultatscreening = mysql_query($recupfamillescreening) or die("Impossible de trouver liste familles table screening : " . mysql_error());
				//~ $while($dnn = mysql_fetch_assoc($resultatscreening)){
				//~ $	echo '"'.$dnn['codefamille'].'",';
				//~ $}
		//~ 
		//~ ]
	//~ });
	//~ 
	//~ $("input#autocompletewholegenomeanalysis").autocomplete({
		//~ source: [
				//~ $$recupfamillewholegenomeanalysis = "SELECT `codefamille`
				//~ $FROM `$db`.`wholegenomeanalysis`";
				//~ $$resultatwholegenomeanalysis = mysql_query($recupfamillewholegenomeanalysis) or die("Impossible de trouver liste familles table wholegenomeanalysis : " . mysql_error());
				//~ $while($dnn = mysql_fetch_assoc($resultatwholegenomeanalysis)){
				//~ $	echo '"'.$dnn['codefamille'].'",';
				//~ $}
		//~ 
		//~ ]
	//~ });
//~ });




//$(document).ready(function(){
	//var listefamillesentrees = '$listefamillesentrees'.split(' ');
	//alert(listefamillesentrees);
	//$('#familleautocompletion1').autocomplete(listefamillesentrees);
	//$('#familleautocompletion2').autocomplete(listefamillesentrees);
	//$('#familleautocompletion3').autocomplete(listefamillesentrees);
	//$('#familleautocompletion4').autocomplete(listefamillesentrees);

//});

function toggleDisplay(valeur, name){
	var nomduchamp = 'div'+name;
	if(valeur == 'other'){
		elmt1 = document.getElementById(nomduchamp);
		elmt1.style.display = 'block';
	}else{
		elmt1 = document.getElementById(nomduchamp);
		elmt1.style.display = 'none';
	}
}


function recupere_clinique(code1, code2, code3, code4, code5){
	var code1 = document.getElementById(code1).value;
	var code2 = document.getElementById(code2).value;
	var code3 = document.getElementById(code3).value;
	var code4 = document.getElementById(code4).value;
	if(code5 != ''){	var code5 = document.getElementById(code5).value; }
	window.open("../commun/see_clinique.php?ind="+code1+"-"+code2+"-"+code3+"-"+code4+"-"+code5+"&from=entry&view=diagnosis");
}


function quit(pathway){
	if(confirm("Exit ?")) {
		document.location.replace(pathway+"/index.php?logout=true");
	}
}

function suppression_fichier(pathway, ind, form, table, fichier){
	if(confirm("Delete file "+fichier+ "?")) {
		document.location.replace("./modif_index.php?ind="+ind+"&form="+form+"&table="+table+"&delete_file="+fichier);
	}else{
		document.location.replace("./see_genetics.php?&ind="+ind);
	}
}

function calcul(rubrique){
	var rubriqueright = rubrique.concat('right');
	for(i=0;i<document.frm.elements[rubriqueright].length;i++){	// appel par le 'name'
	   if(document.frm.elements[rubriqueright][i].checked){
		r=(1*document.frm.elements[rubriqueright][i].value);
		}
	}
	var rubriqueleft = rubrique.concat('left');
	for(i=0;i<document.frm.elements[rubriqueleft].length;i++){
	   if(document.frm.elements[rubriqueleft][i].checked){
		l=(1*document.frm.elements[rubriqueleft][i].value);
		}
	}
	s=(r+l)/2;
	x=document.getElementById('score'.concat(rubrique));x.value=s; // On affecte
}


function recupere_genetique(code1, code2, code3, code4, code5){
	var code1 = document.getElementById(code1).value;
	var code2 = document.getElementById(code2).value;
	var code3 = document.getElementById(code3).value;
	var code4 = document.getElementById(code4).value;
	var code5 = document.getElementById(code5).value;
	window.open("../commun/see_genetics.php?ind="+code1+"-"+code2+"-"+code3+"-"+code4+"-"+code5+"&from=entry");
}

function confirmer_suppression(form, table){
	if(confirm("Delete this entry ?")) {
		document.location.replace("./start.php?form="+form+"&table="+table);
	}else{
		document.location.replace("./start.php");
	}
}


function confirmer_suppression_fichier(fichier, form){
	if(confirm("Delete file "+ fichier +"?")) {
		document.location.replace("./page_principale.php?form="+form+"&delete="+fichier);
	}else{
		document.location.replace("./page_principale.php?form="+form);
	}
}


function confirmer_suppression_consultation(form, ind, from){
	if(confirm("Delete form "+form+ "?")) {
		document.location.replace("./see_clinique.php?from="+from+"&delete="+form+"&view=diagnosis&table=diagnostic&ind="+ind);
	}else{
		document.location.replace("./see_clinique.php?from="+from+"&ind="+ind+"&view=diagnosis");
	}
}

function confirmer_suppression_activity(form, ind, from){
	if(confirm("Delete activity form "+form+ "?")) {
		document.location.replace("./see_clinique.php?from="+from+"&delete="+form+"&view=activity&table=form_activite&ind="+ind);
	}else{
		document.location.replace("./see_clinique.php?from="+from+"&ind="+ind+"&view=activity");
	}
}

function quit(pathway){
	if(confirm("Exit ?")) {
		document.location.replace(pathway+"/index.php?logout=true");
	}
}

function toggleDiagnosticConnu(texte){
	if(texte == 'oui'){
		elmt = document.getElementById('div_diagnostic_genetique');
		elmt.style.display = 'block';
	}else if(texte == 'non'){
		elmt = document.getElementById('div_diagnostic_genetique');
		elmt.style.display = 'none';
	}		
		
}



function surdevouloiruploader(){
	if(confirm("File not found. Do you want to upload family tree file ?")) {
		document.location.replace("./upload_family_tree.php");
	}else{
		document.location.replace("./start.php");
	}
}

function hoverTr() {
	var tabTr = document.getElementsByTagName('data'); // récupération de tous les tr
 
	for(var i = 0; i < tabTr.length; i++) {
	if(tabTr[i].className != 'vert')// filtre sur les tr donc seule celle dont le className != 'vert' changerons de couleur au passage de la souris
	  {
		tabTr[i].onmouseover = survolerTr; //onmouseover
		tabTr[i].onmouseout = QuitterTr; //onmouseout 
	  }	
	}//for
 
	function survolerTr() {
		this.className = 'survolRed';
	}//onmouseover
 
	function QuitterTr() {
		this.className = '';
	}//onmouseout
}


